<template>
  <div class="staticsiticContainer">
    <div class="filterBox">
      <div class="typeTab">
        <span
          :class="typeIndex == 0 ? 'item select' : 'item'"
          @click="typeChange(0)"
          >统计分析</span
        >
        <span
          :class="typeIndex == 1 ? 'item select' : 'item'"
          @click="typeChange(1)"
          >列表数据</span
        >
      </div>
      <!-- <div class="timeRange">
        <el-date-picker
          size="small"
          v-model="filterParams.timeRange"
          type="datetimerange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
      </div>
      <div class="timeStep">
        <el-radio-group v-model="filterParams.radio" size="small">
          <el-radio :label="3">本月</el-radio>
          <el-radio :label="6">本周</el-radio>
          <el-radio :label="9">近三月</el-radio>
          <el-radio :label="9">近三年</el-radio>
          <el-radio :label="9">今年以来</el-radio>
        </el-radio-group>
      </div>
      <div class="btnBox">
        <el-button icon="el-icon-refresh" size="small" @click="onReset"
          >重置</el-button
        >
        <el-button
          type="primary"
          icon="el-icon-search"
          size="small"
          @click="onSearch"
          >查询</el-button
        >
      </div> -->
    </div>
    <chartsBox v-if="typeIndex == 0" :dataSource="data" />
    <tableBox v-else :dataSource="data" />
  </div>
</template>

<script>
import chartsBox from "./chartsBox.vue";
import tableBox from "./tableBox.vue";
export default {
  components: {
    chartsBox,
    tableBox,
  },
  data() {
    return {
      typeIndex: 0,
      filterParams: {
        timeRange: "",
        radio: 3,
      },
      data: {},
    };
  },
  mounted() {},
  methods: {
    typeChange(index) {
      this.typeIndex = index;
    },
    onSearch() {
      this.data = JSON.parse(JSON.stringify(this.filterParams)); 
    },
    onReset() {
      this.filterParams = {};
      this.data = {};
    },
  },
};
</script>

<style lang="scss" scoped>
.staticsiticContainer {
  height: calc(100vh - 50px);
  background-color: #f5f5f5;
  position: relative;
  padding: 0 10px;
  padding-top: 10px;
  font-size: 15px;
  .filterBox {
    background-color: #fff;
    padding: 15px 0px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    .typeTab {
      box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.5);
      margin-left: 20px;
      height: 100%;
      cursor: pointer;
      .item {
        padding: 0 15px;
        height: 35px;
        line-height: 35px;
        display: inline-block;
      }
      .select {
        background-color: #409eff;
        color: #fff;
      }
    }
    .timeRange {
      margin-left: 20px;
      /deep/ .el-input__inner {
        height: 36px;
        width: 300px;
      }
    }
    .timeStep {
      margin-left: 20px;
      /deep/ .el-radio {
        margin-right: 15px;
      }
    }
    .btnBox {
      margin-left: 20px;
    }
  }
  .cardBox {
    margin-top: 10px;
    .userCount {
      display: flex;
      flex: 1;
      justify-content: space-between;
      .item {
        width: 24.5%;
        border-radius: 3px;
        background-color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 70px 0;
        font-size: 32px;
        flex-wrap: wrap;
        .count {
          width: 100%;
          text-align: center;
          color: #9d6bed;
        }
        .label {
          position: relative;
          font-size: 16px;
          margin-top: 5px;
          .increase {
            position: absolute;
            top: 0px;
            left: 100%;
            width: 100px;
            margin-left: 5px;
            font-size: 15px;
            color: rgb(235, 87, 77);
            font-weight: bold;
            .img {
              width: 18px;
              vertical-align: bottom;
            }
          }
        }
      }
    }
    .chartMain {
      margin-top: 10px;
      display: flex;
      justify-content: space-between;
      .chartItem {
        padding: 20px 15px;
        width: 49.7%;
        background-color: #fff;
        border-radius: 3px;
        .title {
          position: relative;
          padding-left: 12px;
          font-weight: bold;
          margin-bottom: 20px;
          &::before {
            position: absolute;
            top: 50%;
            content: "";
            left: 0;
            width: 4px;
            height: 15px;
            border-radius: 2px;
            background-color: #409eff;
            transform: translateY(-50%);
          }
        }
        .content {
          display: flex;
          align-items: center;
          .des {
            min-width: 200px;
            border-radius: 3px;
            padding: 20px 10px;
            background-color: rgba(61, 155, 248, 0.1);
            align-items: center;
            .desItem {
              margin-bottom: 15px;
              &:last-child {
                margin-bottom: 0px;
              }
            }
            .label {
              display: inline-block;
              width: 24px;
              height: 13px;
              border-radius: 2px;
              background-color: #9d6bed;
            }
            .value {
              display: inline-block;
            }
          }
        }
        #pieEcharts {
          flex: 1;
          height: 400px;
        }
        #lineEcharts {
          width: 100%;
          height: 400px;
        }
      }

      .userNumber {
        padding: 0 30px;
        display: flex;
        justify-content: space-around;
        margin-bottom: 20px;
        gap: 10px;
        .boxItem {
          padding: 20px 20px;
          flex: 1;
          box-shadow: 0 0.02rem 0.37rem 0 #efefef;
          .label {
            color: #999;
          }
          .value {
            font-size: 20px;
            margin-top: 5px;
          }
        }
      }
    }
  }
}
</style>
